package baseTest;


import java.util.Arrays;

public class rotate {
    public static void main(String[] args) {
        int[] nums = {1,2,3,4,5,6,7};
        process(nums,3);
        Arrays.stream(nums).forEach(System.out::print);
    }
    public static void process(int[] nums,int k){
        int[] rotate = new int[k];
        for (int i = 1; i <= k ; i++) {
            rotate[i-1] = nums[nums.length-i];
        }
        int j = nums.length-k-1;
        while (j>=0){
            nums[j+k] = nums[j];
            j--;
        }
        for (int i = 1; i <= rotate.length; i++) {
            nums[i-1] = rotate[rotate.length-i];
        }

    }
}
